/**
 * Created by OJesusO on 2017/12/13.
 * @description 加载 toolbox xml 文件功能
 * @author OJesusO
 * @last 2017/12/13
 */
(function(){
    var callback = null, status = false,
    match = location.search.match(/toolbox=([^&=\/]+)/),
    toolbox = match ? match[1] : 'simple';
    var url='/static/js/toolbox/'+ toolbox +'.xml';
    if(window.language_code!='zh-hans'){
        url='/static/js/toolbox/en_'+ toolbox +'.xml';
    }
    $.ajax({
        url: url,
        dataType: "xml",
        success: function (data) {
            toolbox = $(data).find('xml').get(0);
            status = true;
            if (callback) {
                console.info('load toolbox-xml lazy!');
                callback();
            }
        },
        error: function (XMLHttpRequest, textStatus, errorThrown) {
            console.error(textStatus, errorThrown);
            toolbox = null;
            status = true;
            if (callback) {
                console.info('load toolbox-xml error!');
                callback();
            }
        }
    });
    window.toolboxReady = function () {
        callback = function(){ start() };
        if (status) {
            console.info('loaded toolbox-xml!');
            callback();
        }
    };
    window.toolboxXml = function () {
        return toolbox;
    };
}());

/*
  min:
  eval(function(p,a,c,k,e,r){e=function(c){return c.toString(36)};if('0'.replace(0,e)==0){while(c--)r[e(c)]=k[c];k=[function(e){return r[e]||e}];e=function(){return'[2-9a-i]'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(4(){var 3=c,6=false,7=location.search.7(/2=([^&=\\/]+)/),2=7?7[1]:\'simple\';$.ajax({url:\'js/2/\'+2+\'.5\',dataType:"5",success:4(d){2=$(d).find(\'5\').get(0);6=e;9(3){8.a(\'f 2-5 lazy!\');3()}},b:4(XMLHttpRequest,g,h){8.b(g,h);2=c;6=e;9(3){8.a(\'f 2-5 b!\');3()}}});i.toolboxReady=4(){3=4(){start()};9(6){8.a(\'loaded 2-5!\');3()}};i.toolboxXml=4(){return 2}}());',[],19,'||toolbox|callback|function|xml|status|match|console|if|info|error|null|data|true|load|textStatus|errorThrown|window'.split('|'),0,{}))
*/
